import 'dart:convert';

class ApiResponse<T> {
  final T? data;
  final String? message;
  final int? code;

  ApiResponse({
    this.data,
    this.message,
    this.code,
  });

  // 工厂方法：从 JSON 构造 ApiResponse 对象
  factory ApiResponse.fromJson(Map<String, dynamic> json, T Function(Map<String, dynamic>) fromJsonT) {
    return ApiResponse(
      data: fromJsonT(json['data']),
      code: json['code'],
      message: json['message'],
    );
  }

  // 转换为 JSON 的方法
  Map<String, dynamic> toJson() {
    return {
      'data': data,
      'code': code,
      'message': message,
    };
  }

  @override
  String toString() {
    return 'ApiResponse(data: $data, code: $code, message: $message)';
  }
}

class ApiResponse2<T> {
  final T? data;
  final String? message;
  final String? msg;
  final int? code;
  final String? key;

  ApiResponse2({
    this.data,
    this.message,
    this.msg,
    this.code,
    this.key,
  });

  // 工厂方法：从 JSON 构造 ApiResponse 对象
  factory ApiResponse2.fromJson(Map<String, dynamic> json, T Function(Map<String, dynamic>) fromJsonT) {
    return ApiResponse2(
      data: fromJsonT(json['data']),
      code: json['code'],
      message: json['message'],
      msg: json['msg'],
      key: json['key'],
    );
  }

  // 转换为 JSON 的方法
  Map<String, dynamic> toJson() {
    return {
      'data': data,
      'code': code,
      'message': message,
      'msg': msg,
      'key': key,
    };
  }

  @override
  String toString() {
    return 'ApiResponse2(data: $data, code: $code, message: $message,msg: $msg),key: $key)';
  }
}

class FetchDataRequest2 {
  final int isPublic;
  final int minPrice;
  final int maxPrice;
  final int offset;
  final int fetchSize;
  final String orderBy;
  final String interest;
  final String name;
  final String brand;
  final String series;

  FetchDataRequest2({
    this.isPublic = 0,
    this.minPrice = 0,
    this.maxPrice = 99999999,
    this.offset = 0,
    this.fetchSize = 10,
    this.orderBy = "price asc",
    this.interest = "",
    this.name = "",
    this.brand = "",
    this.series = "",
  });

  Map<String, dynamic> toJson() {
    return {
      'isPublic': isPublic,
      'minPrice': minPrice,
      'maxPrice': maxPrice,
      'offset': offset,
      'fetchSize': fetchSize,
      'orderBy': orderBy,
      'interest': interest,
      'name': name,
      'brand': brand,
      'series': series,
    };
  }
}

class Data5 {
  final int total;
  final List<Commodity> list;

  Data5({
    required this.total,
    required this.list,
  });

  // 将 JSON 转换为 Data5 对象
  factory Data5.fromJson(Map<String, dynamic> json) {
    return Data5(
      total: json['total'],
      list: (json['list'] as List)
          .map((item) => Commodity.fromJson(item))
          .toList(),
    );
  }

  // 将 Data5 对象转换为 JSON
  Map<String, dynamic> toJson() {
    return {
      'total': total,
      'list': list.map((item) => item.toJson()).toList(),
    };
  }
}










class LoginBean {
  final String? userId;
  final String? companyId;
  final String? qrCode;
  final String? accessToken;

  LoginBean({
    this.userId,
    this.companyId,
    this.qrCode,
    this.accessToken,
  });

  // Factory method to create Data from JSON
  factory LoginBean.fromJson(Map<String, dynamic> json) {
    return LoginBean(
      userId: json['userId'],
      companyId: json['companyId'],
      qrCode: json['qrCode'],
      accessToken: json['accessToken'],
    );
  }

  // 重写 toString() 方法
  @override
  String toString() {
    return 'Data(userId: $userId, companyId: $companyId, qrCode: $qrCode)';
  }
}


class Commodity {
  final String id;
  final String? createTime;
  final String? spec;
  final String? updateTime;
  final int? isValid;
  final String? firstCommodityTreeId;
  final String? firstCommodityTreeName;
  final String? commodityTreeId;
  final String? commodityTreeName;
  final String? commodityTreeIdWz;
  final String? commodityTreeNameWz;
  final String? name;
  final String? sxType;
  final String? modelId;
  final double? price;
  final String? userId;
  final String? onlineStatus;
  final String? comType;
  final String? status;
  final String? typeStr;
  final String? materialRootId;
  final String? wtStatus;
  final String? attrJson;
  final String? unit;
  final double? width;
  final double? high;
  final double? thickness;
  final double? loss;
  final double? specialRatio;
  final String? comBody;
  final String? labelId;
  final String? brand;
  final String? marking;
  final String? series;
  final String thumbnail;
  final String? isGroup;
  final String? atrr;
  final String? style;
  final String? interest;
  final String? address;
  final String? companyId;
  final String? ryz;
  final String? stuffStr;
  final String? color;
  final String? materialChannelId;
  final String? isChoice;
  final CommodityImg? commodityImg;
  final String? relatedMaterialId;
  final String? relatedMaterialType;
  final String? waveguideLine;
  final String? unitName;
  final String? labelNames;
  final String? interestName;
  final String? sxTypeName;
  final String? createUserName;

  // Constructor
  Commodity({
    required this.id,
    this.createTime,
    this.spec,
    this.updateTime,
    this.isValid,
    this.firstCommodityTreeId,
    this.firstCommodityTreeName,
    this.commodityTreeId,
    this.commodityTreeName,
    this.commodityTreeIdWz,
    this.commodityTreeNameWz,
    this.name,
    this.sxType,
    this.modelId,
    this.price,
    this.userId,
    this.onlineStatus,
    this.comType,
    this.status,
    this.typeStr,
    this.materialRootId,
    this.wtStatus,
    this.attrJson,
    this.unit,
    this.width,
    this.high,
    this.thickness,
    this.loss,
    this.specialRatio,
    this.comBody,
    this.labelId,
    this.brand,
    this.marking,
    this.series,
    required this.thumbnail,
    this.isGroup,
    this.atrr,
    this.style,
    this.interest,
    this.address,
    this.companyId,
    this.ryz,
    this.stuffStr,
    this.color,
    this.materialChannelId,
    this.isChoice,
    this.commodityImg,
    this.relatedMaterialId,
    this.relatedMaterialType,
    this.waveguideLine,
    this.unitName,
    this.labelNames,
    this.interestName,
    this.sxTypeName,
    this.createUserName,
  });

  // Factory method to create Commodity from JSON
  factory Commodity.fromJson(Map<String, dynamic> json) {
    return Commodity(
      id: json['id'],
      createTime: json['createTime'],
      spec: json['spec'],
      updateTime: json['updateTime'],
      isValid: json['isValid'],
      firstCommodityTreeId: json['firstCommodityTreeId'],
      firstCommodityTreeName: json['firstCommodityTreeName'],
      commodityTreeId: json['commodityTreeId'],
      commodityTreeName: json['commodityTreeName'],
      commodityTreeIdWz: json['commodityTreeIdWz'],
      commodityTreeNameWz: json['commodityTreeNameWz'],
      name: json['name'],
      sxType: json['sxType'],
      modelId: json['modelId'],
      price: json['price']?.toDouble(),
      userId: json['userId'],
      onlineStatus: json['onlineStatus'],
      comType: json['comType'],
      status: json['status'],
      typeStr: json['typeStr'],
      materialRootId: json['materialRootId'],
      wtStatus: json['wtStatus'],
      attrJson: json['attrJson'],
      unit: json['unit'],
      width: json['width']?.toDouble(),
      high: json['high']?.toDouble(),
      thickness: json['thickness']?.toDouble(),
      loss: json['loss']?.toDouble(),
      specialRatio: json['specialRatio'],
      comBody: json['comBody'],
      labelId: json['labelId'],
      brand: json['brand'],
      marking: json['marking'],
      series: json['series'],
      thumbnail: json['thumbnail'],
      isGroup: json['isGroup'],
      atrr: json['atrr'],
      style: json['style'],
      interest: json['interest'],
      address: json['address'],
      companyId: json['companyId'],
      ryz: json['ryz'],
      stuffStr: json['stuffStr'],
      color: json['color'],
      materialChannelId: json['materialChannelId'],
      isChoice: json['isChoice'],
      commodityImg: json['commodityImg'] != null
          ? CommodityImg.fromJson(json['commodityImg'])
          : null,
      relatedMaterialId: json['relatedMaterialId'],
      relatedMaterialType: json['relatedMaterialType'],
      waveguideLine: json['waveguideLine'],
      unitName: json['unitName'],
      labelNames: json['labelNames'],
      interestName: json['interestName'],
      sxTypeName: json['sxTypeName'],
      createUserName: json['createUserName'],
    );
  }

  // Method to convert the object to a Map
  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'createTime': createTime,
      'spec': spec,
      'updateTime': updateTime,
      'isValid': isValid,
      'firstCommodityTreeId': firstCommodityTreeId,
      'firstCommodityTreeName': firstCommodityTreeName,
      'commodityTreeId': commodityTreeId,
      'commodityTreeName': commodityTreeName,
      'commodityTreeIdWz': commodityTreeIdWz,
      'commodityTreeNameWz': commodityTreeNameWz,
      'name': name,
      'sxType': sxType,
      'modelId': modelId,
      'price': price,
      'userId': userId,
      'onlineStatus': onlineStatus,
      'comType': comType,
      'status': status,
      'typeStr': typeStr,
      'materialRootId': materialRootId,
      'wtStatus': wtStatus,
      'attrJson': attrJson,
      'unit': unit,
      'width': width,
      'high': high,
      'thickness': thickness,
      'loss': loss,
      'specialRatio': specialRatio,
      'comBody': comBody,
      'labelId': labelId,
      'brand': brand,
      'marking': marking,
      'series': series,
      'thumbnail': thumbnail,
      'isGroup': isGroup,
      'atrr': atrr,
      'style': style,
      'interest': interest,
      'address': address,
      'companyId': companyId,
      'ryz': ryz,
      'stuffStr': stuffStr,
      'color': color,
      'materialChannelId': materialChannelId,
      'isChoice': isChoice,
      'commodityImg': commodityImg?.toJson(),
      'relatedMaterialId': relatedMaterialId,
      'relatedMaterialType': relatedMaterialType,
      'waveguideLine': waveguideLine,
      'unitName': unitName,
      'labelNames': labelNames,
      'interestName': interestName,
      'sxTypeName': sxTypeName,
      'createUserName': createUserName,
    };
  }
}


class CommodityImg {
  final String id;
  final String createTime;
  final String updateTime;
  final int isValid;
  final String commodityId;
  final String videoUrl;
  final String detailImgUrl;
  final String rotatingImgs;

  // Constructor
  CommodityImg({
    required this.id,
    required this.createTime,
    required this.updateTime,
    required this.isValid,
    required this.commodityId,
    required this.videoUrl,
    required this.detailImgUrl,
    required this.rotatingImgs,
  });

  // Factory method to create CommodityImg from JSON
  factory CommodityImg.fromJson(Map<String, dynamic> json) {
    return CommodityImg(
      id: json['id'] as String,
      createTime: json['createTime'] as String,
      updateTime: json['updateTime'] as String,
      isValid: json['isValid'] as int,
      commodityId: json['commodityId'] as String,
      videoUrl: json['videoUrl'] as String,
      detailImgUrl: json['detailImgUrl'] as String,
      rotatingImgs: json['rotatingImgs'] as String,
    );
  }

  // Method to convert CommodityImg to JSON
  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'createTime': createTime,
      'updateTime': updateTime,
      'isValid': isValid,
      'commodityId': commodityId,
      'videoUrl': videoUrl,
      'detailImgUrl': detailImgUrl,
      'rotatingImgs': rotatingImgs,
    };
  }
}


class Customer {
  final String customerName;
  final String customerPhone;
  final String customerStatus;
  final String customerStatusValue;
  final int renderCount;
  final double renderTotalAmount;
  final String latestCreateTime;
  final double latestAmount;

  Customer({
    required this.customerName,
    required this.customerPhone,
    required this.customerStatus,
    required this.customerStatusValue,
    required this.renderCount,
    required this.renderTotalAmount,
    required this.latestCreateTime,
    required this.latestAmount,
  });

  // 从 JSON 转换为 Customer 对象
  factory Customer.fromJson(Map<String, dynamic> json) {
    return Customer(
      customerName: json['customerName'],
      customerPhone: json['customerPhone'],
      customerStatus: json['customerStatus']??"",
      customerStatusValue: json['customerStatusValue']??"",
      renderCount: json['renderCount'],
      renderTotalAmount: (json['renderTotalAmount'] as num).toDouble(),
      latestCreateTime: json['latestCreateTime'],
      latestAmount: (json['latestAmount'] as num).toDouble(),
    );
  }

  // 转换 Customer 对象为 JSON
  Map<String, dynamic> toJson() {
    return {
      'customerName': customerName,
      'customerPhone': customerPhone,
      'customerStatus': customerStatus,
      'customerStatusValue': customerStatusValue,
      'renderCount': renderCount,
      'renderTotalAmount': renderTotalAmount,
      'latestCreateTime': latestCreateTime,
      'latestAmount': latestAmount,
    };
  }
}

class Data963 {
  final dynamic locationTotal; // 使用 dynamic 来兼容可能的 null 值和任意类型
  final int total;
  final List<Task> list;
  final dynamic totalPages; // 使用 dynamic 来兼容可能的 null 值和任意类型

  Data963({
    required this.locationTotal,
    required this.total,
    required this.list,
    required this.totalPages,
  });

  // 从 JSON 转换为 Data9 对象
  factory Data963.fromJson(Map<String, dynamic> json) {
    return Data963(
      locationTotal: json['locationTotal'],
      total: json['total'],
      list: (json['list'] as List)
          .map((item) => Task.fromJson(item))
          .toList(),
      totalPages: json['totalPages'],
    );
  }

  // 转换 Data9 对象为 JSON
  Map<String, dynamic> toJson() {
    return {
      'locationTotal': locationTotal,
      'total': total,
      'list': list.map((item) => item.toJson()).toList(),
      'totalPages': totalPages,
    };
  }
}


class Data9 {
  final dynamic locationTotal; // 使用 dynamic 来兼容可能的 null 值和任意类型
  final int total;
  final List<Customer> list;
  final dynamic totalPages; // 使用 dynamic 来兼容可能的 null 值和任意类型

  Data9({
    required this.locationTotal,
    required this.total,
    required this.list,
    required this.totalPages,
  });

  // 从 JSON 转换为 Data9 对象
  factory Data9.fromJson(Map<String, dynamic> json) {
    return Data9(
      locationTotal: json['locationTotal'],
      total: json['total'],
      list: (json['list'] as List)
          .map((item) => Customer.fromJson(item))
          .toList(),
      totalPages: json['totalPages'],
    );
  }

  // 转换 Data9 对象为 JSON
  Map<String, dynamic> toJson() {
    return {
      'locationTotal': locationTotal,
      'total': total,
      'list': list.map((item) => item.toJson()).toList(),
      'totalPages': totalPages,
    };
  }
}


class FetchDataRequest9<T> {
  final T condition;
  final int offset;
  final int fetchSize;

  FetchDataRequest9({
    required this.condition,
    this.offset = 0,
    this.fetchSize = 1000000,
  });

  // 从 JSON 转换为 FetchDataRequest9 对象
  factory FetchDataRequest9.fromJson(
      Map<String, dynamic> json, T Function(dynamic) fromJsonT) {
    return FetchDataRequest9<T>(
      condition: fromJsonT(json['condition']),
      offset: json['offset'] ?? 0,
      fetchSize: json['fetchSize'] ?? 1000000,
    );
  }

  // 转换 FetchDataRequest9 对象为 JSON
  Map<String, dynamic> toJson(Object Function(T) toJsonT) {
    return {
      'condition': toJsonT(condition),
      'offset': offset,
      'fetchSize': fetchSize,
    };
  }
}



// data class Condition7(
// val customerName: String,
// val customerPhone: String,
// val taskStatus: Int=3,
// )

class Condition7 {
final String customerName;
final String customerPhone;
final int taskStatus;

// 构造函数
Condition7({
this.customerName = "",
this.customerPhone = "",
}) : taskStatus = 3; // 在初始化列表中设置 taskStatus 的默认值

// 转换 Condition3 实例为 JSON
Map<String, dynamic> toJson() {
return {
'customerName': customerName,
'customerPhone': customerPhone,
'taskStatus': taskStatus,
};
}
}


class Condition3 {
  final String customerName;
  final String customerPhone;
  final String customerStatus;
  final int taskStatus;

  // 构造函数
  Condition3({
    this.customerName = "",
    this.customerPhone = "",
    this.customerStatus = "",
  }) : taskStatus = 3; // 在初始化列表中设置 taskStatus 的默认值

  // 转换 Condition3 实例为 JSON
  Map<String, dynamic> toJson() {
    return {
      'customerName': customerName,
      'customerPhone': customerPhone,
      'customerStatus': customerStatus,
      'taskStatus': taskStatus,
    };
  }
}


//客户渲染详情： response：{"data":{"locationTotal":null,"total":1,"list":[{"id":"3c3034f34b7445fe9db8542ea714bbb0",
// "taskType":0,"status":15,"taskStatus":3,
// "endTime":"2024-12-18 17:50:16","name":"20241218174408",
// "designName":"暖色侘寂-时光见证家的温暖","url":"https://720.xmlights.com/720show/preview?recordId=3c3034f34b7445fe9db8542ea714bbb0",
// "robotName":"ROBOT2674E5","renderTotalAmount":85.0,
// "quoteTotalAmount":155620.19}],"totalPages":null},"code":200,"message":"success"}
//

class Task {
  final String id;
  final int taskType;
  final int status;
  final int taskStatus;
  final String endTime;
  final String designName;
  final String housePlanName;
  final double renderTotalAmount;
  final double quoteTotalAmount;
  final String url;

  // 构造函数
  Task({
    required this.id,
    required this.taskType,
    required this.status,
    required this.taskStatus,
    required this.endTime,
    required this.designName,
    required this.url,
    required this.renderTotalAmount,
    required this.quoteTotalAmount,
    required this.housePlanName,
  });

  // 从 JSON 创建 Task 实例
  factory Task.fromJson(Map<String, dynamic> json) {
    return Task(
      id: json['id'] as String,
      taskType: json['taskType'] as int,
      status: json['status'] as int,
      taskStatus: json['taskStatus'] as int,
      endTime: json['endTime'] as String,
      housePlanName: json['housePlanName'] as String,
      designName: json['designName'] as String,
      renderTotalAmount: json['renderTotalAmount'] as double,
      quoteTotalAmount: (json['quoteTotalAmount'] as double?) ?? 0.0,
      url: json['url'] as String,
    );
  }

  // 转换 Task 实例为 JSON
  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'taskType': taskType,
      'status': status,
      'taskStatus': taskStatus,
      'endTime': endTime,
      'designName': designName,
      'housePlanName': housePlanName,
      'renderTotalAmount': renderTotalAmount,
      'quoteTotalAmount': quoteTotalAmount,
      'url': url,
    };
  }
}

/// Item147 类的 Dart 实现
class Item147 {
  /// 0 为开始, 1 为中间, 2 为末尾
  final int position;
  final String id;
  final String url;
  final bool isTitle;
  final int count;
  final bool success;
  final String device;
  final String name;
  final String date;
  final double renderTotalAmount;
  final double quoteTotalAmount;
  final String housePlanName;

  /// 构造函数
  const Item147({
    /**
     *   0 为开始
     *   1 为中间
     *   2 为末尾.
     *
     *   3  同时是开始和结尾
     */
    this.position = -1,
    this.id = "0",
    this.url = "0",
    this.housePlanName = "",
    this.isTitle = false,
    this.count = 0,
    this.renderTotalAmount = 0.0,
    this.quoteTotalAmount = 0.0,
    this.success = true,
    this.device = "",
    this.name = "",
    this.date = "",
  });

  /// 从 JSON 创建 Item147 实例
  factory Item147.fromJson(Map<String, dynamic> json) {
    return Item147(
      position: json['position'] ?? -1,
      id: json['id'] ?? "0",
      isTitle: json['isTitle'] ?? false,
      count: json['count'] ?? 0,
      housePlanName: json['housePlanName'] ?? "",
      url: json['url'] ?? "",
      success: json['success'] ?? true,
      device: json['device'] ?? "设备001",
      name: json['name'] ?? "沿海地中海风格三室两厅",
      date: json['date'] ?? "2023年7月23日 15:12",
      renderTotalAmount: json['renderTotalAmount'] as double,
      quoteTotalAmount: json['quoteTotalAmount'] as double,
    );
  }

  /// 转换为 JSON
  Map<String, dynamic> toJson() {
    return {
      'position': position,
      'id': id,
      'isTitle': isTitle,
      'url': url,
      'count': count,
      'success': success,
      'housePlanName': housePlanName,
      'device': device,
      'name': name,
      'date': date,
      'renderTotalAmount': renderTotalAmount,
      'quoteTotalAmount': quoteTotalAmount,
    };
  }
}

class HouseLayoutItem {
  final String id;
  final String? name;
  final String? companyId;
  final int roomNum;
  final int hallNum;
  final int washroomNum;
  final String? houseType;
  final String userId;
  final int type;
  final int childCount;
  final double innerArea;
  final String pictureUrl;
  final String thumbnail;
  final String source;
  final int status;
  final double price;
  final int isValid;
  final int isUpper;
  final String createTime;
  final String readResultDataId;
  final int renderCount; // 是否有户型数据

  HouseLayoutItem({
    required this.id,
    this.name,
    required  this.thumbnail,
    this.companyId,
    required this.roomNum,
    required this.hallNum,
    required this.washroomNum,
    this.houseType,
    required this.userId,
    required this.type,
    required this.childCount,
    required this.innerArea,
    required this.pictureUrl,
    required this.source,
    required this.status,
    required this.price,
    required this.isValid,
    required this.isUpper,
    required this.createTime,
    required this.readResultDataId,
    required this.renderCount,
  });

  // Optional: Add factory method to create an object from a map
  factory HouseLayoutItem.fromJson(Map<String, dynamic> json) {
    return HouseLayoutItem(
      id: json['id'],
      name: json['name'],
      thumbnail: json['thumbnail']??'',
      companyId: json['companyId'],
      roomNum: json['roomNum']??0,
      hallNum: json['hallNum']??0,
      washroomNum: json['washroomNum']??0,
      houseType: json['houseType'],
      userId: json['userId'],
      type: json['type'],
      childCount: json['childCount'],
      innerArea: json['innerArea'],
      pictureUrl: json['pictureUrl'],
      source: json['source'],
      status: json['status'],
      price: json['price'],
      isValid: json['isValid'],
      isUpper: json['isUpper'],
      createTime: json['createTime'],
      readResultDataId: json['readResultDataId']??"",
      renderCount: json['renderCount'],
    );
  }

  // Optional: Convert an object to a map
  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'name': name,
      'thumbnail': thumbnail,
      'companyId': companyId,
      'roomNum': roomNum,
      'hallNum': hallNum,
      'washroomNum': washroomNum,
      'houseType': houseType,
      'userId': userId,
      'type': type,
      'childCount': childCount,
      'innerArea': innerArea,
      'pictureUrl': pictureUrl,
      'source': source,
      'status': status,
      'price': price,
      'isValid': isValid,
      'isUpper': isUpper,
      'createTime': createTime,
      'readResultDataId': readResultDataId,
      'renderCount': renderCount,
    };
  }
}

class HouseLayoutData {
  final int? totalPages;
  final int total;
  final List<HouseLayoutItem> list;
  final dynamic locationTotal; // Use `dynamic` for flexibility; refine based on actual type

  HouseLayoutData({
    this.totalPages,
    required this.total,
    required this.list,
    this.locationTotal,
  });

  // Factory constructor to create an instance from JSON
  factory HouseLayoutData.fromJson(Map<String, dynamic> json) {
    return HouseLayoutData(
      totalPages: json['totalPages'],
      total: json['total'],
      list: (json['list'] as List)
          .map((item) => HouseLayoutItem.fromJson(item))
          .toList(),
      locationTotal: json['locationTotal'],
    );
  }

  // Method to convert the object to a JSON map
  Map<String, dynamic> toJson() {
    return {
      'totalPages': totalPages,
      'total': total,
      'list': list.map((item) => item.toJson()).toList(),
      'locationTotal': locationTotal,
    };
  }
}



class HouseLayoutData2 {
  final List<SysDictType> list;

  HouseLayoutData2({
    required this.list,
  });

  // Factory constructor to create an instance from JSON
  factory HouseLayoutData2.fromJson(Map<String, dynamic> json) {
    return HouseLayoutData2(
      list: (json['list'] as List)
          .map((item) => SysDictType.fromJson(item))
          .toList(),
    );
  }

  // Method to convert the object to a JSON map
  Map<String, dynamic> toJson() {
    return {
      'list': list.map((item) => item.toJson()).toList(),
    };
  }
}


class Condition2 {
  final String name;
  final String estate;
  final String houseType;
  final String createUserIds;

  Condition2({
    this.name = "",
    this.estate = "",
    this.houseType = "",
    this.createUserIds = "",
  });

  // Factory constructor to create an instance from JSON
  factory Condition2.fromJson(Map<String, dynamic> json) {
    return Condition2(
      name: json['name'] ?? "",
      estate: json['estate'] ?? "",
      houseType: json['houseType'] ?? "",
      createUserIds: json['createUserIds'] ?? "",
    );
  }

  // Method to convert the object to a JSON map
  Map<String, dynamic> toJson() {
    return {
      'name': name,
      'estate': estate,
      'houseType': houseType,
      'createUserIds': createUserIds,
    };
  }
}


class Condition8 {
  final String name;

  Condition8({
    this.name = "",
  });

  // Factory constructor to create an instance from JSON
  factory Condition8.fromJson(Map<String, dynamic> json) {
    return Condition8(
      name: json['name'] ?? "",
    );
  }

  // Method to convert the object to a JSON map
  Map<String, dynamic> toJson() {
    return {
      'name': name,
    };
  }
}

class SysDictType {
  final String id;
  final String updateTime;
  final String code;
  final String name;
  final int showIndex;
  final String type;
  final String status;
  final String remark;

  SysDictType({
    this.id = "-1",
    this.updateTime = "",
    this.code = "",
    this.name = "全部",
    this.showIndex = -1,
    this.type = "",
    this.status = "-",
    this.remark = "全部",
  });

  // Factory method to create a HouseType from a JSON object
  factory SysDictType.fromJson(Map<String, dynamic> json) {
    return SysDictType(
      id: json['id'] ?? "-1",
      updateTime: json['updateTime'] ?? "",
      code: json['code'] ?? "",
      name: json['name'] ?? "全部",
      showIndex: json['showIndex'] ?? -1,
      type: json['type'] ?? "",
      status: json['status'] ?? "-",
      remark: json['remark'] ?? "全部",
    );
  }

  // Convert a HouseType instance to a JSON object
  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'updateTime': updateTime,
      'code': code,
      'name': name,
      'showIndex': showIndex,
      'type': type,
      'status': status,
      'remark': remark,
    };
  }
}

class HouseTypeResponse {
  final List<SysDictType> data;

  HouseTypeResponse({required this.data});

  // Factory constructor to create a response object from a JSON map
  factory HouseTypeResponse.fromJson(Map<String, dynamic> json) {
    return HouseTypeResponse(
      data: (json['data'] as List)
          .map((item) => SysDictType.fromJson(item))
          .toList(),
    );
  }
}


class DataInfo {
  final dynamic locationTotal;
  final int total;
  final List<UserInfo> list;
  final dynamic totalPages;

  DataInfo({
    required this.locationTotal,
    required this.total,
    required this.list,
    required this.totalPages,
  });

  factory DataInfo.fromJson(Map<String, dynamic> json) {
    return DataInfo(
      locationTotal: json['locationTotal'],
      total: json['total'],
      list: (json['list'] as List<dynamic>)
          .map((item) => UserInfo.fromJson(item as Map<String, dynamic>))
          .toList(),
      totalPages: json['totalPages'],
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'locationTotal': locationTotal,
      'total': total,
      'list': list.map((item) => item.toJson()).toList(),
      'totalPages': totalPages,
    };
  }
}

class UserInfo {
  final String id;
  final String nickname;
  final dynamic companyId;
  final dynamic companyName;

  UserInfo({
    required this.id,
    required this.nickname,
    this.companyId,
    this.companyName,
  });

  factory UserInfo.fromJson(Map<String, dynamic> json) {
    return UserInfo(
      id: json['id'] as String,
      nickname: json['nickname'] as String,
      companyId: json['companyId'],
      companyName: json['companyName'],
    );
  }

  Map<String, dynamic> toJson() {
    return {
      'id': id,
      'nickname': nickname,
      'companyId': companyId,
      'companyName': companyName,
    };
  }
}



